﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThermalEquipmentDesign.Model;
using System.Windows.Input;
using System.Windows;
using ThermalEquipmentDesign.Model.Condenser.SprinklerR717;
using ThermalEquipmentDesign.Reference_Path;
using ThermalEquipmentDesign.Reference_Path.Condenser;

namespace ThermalEquipmentDesign.ViewModel.Condenser
{
    public class SprinklerR717ViewModel : ObservableObject
    {
        // Declare fields for binding
        #region fields for binding
        private SprinklerR717 osprinklerR717 = new SprinklerR717();
        private SprinklerR717Result osprinklerR717Result = new SprinklerR717Result();
        private ICommand calculateSprinklerR717;
        private String stooltip = "Press F1 for Help";
        #endregion

        // Create properties for binding
        #region properties for binding
        public String sTooltip
        {
            get { return stooltip; }
            set { stooltip = value; }
        }

        public SprinklerR717 oSprinklerR717
        {
            get { return osprinklerR717; }
            set
            {
                if (value != osprinklerR717)
                {
                    osprinklerR717 = value;
                    OnPropertyChanged("oSprinklerR717");                    
                }
            }
        }

        public SprinklerR717Result oSprinklerR717Result
        {
            get { return osprinklerR717Result; }
            set {
                if (value != osprinklerR717Result)
                {
                    osprinklerR717Result = value;
                    OnPropertyChanged("oSprinklerR717Result");
                }          
            }
        }

        public ICommand CalculateSprinklerR717
        {
            get
            {
                if (calculateSprinklerR717 == null)
                {
                    calculateSprinklerR717 = new RelayCommand(
                        param => ImplementCalculationSprinklerR717()
                    );
                }
                return calculateSprinklerR717;
            }
        }
        #endregion

        /// <summary>
        /// Calculate design parameter for Sprinkler Condenser
        /// </summary>
        public void ImplementCalculationSprinklerR717()
        {            
            SprinklerR717Model oSprinklerR717Model = new SprinklerR717Model();
            osprinklerR717Result = oSprinklerR717Model.ImplementCalculation(osprinklerR717);
        }
        //  Load Reference for the helping
        public void LoadReference(string sIndex)
        {
            System.Windows.Forms.Help.ShowHelp(null, ReferencePath.ReferenceFile, System.Windows.Forms.HelpNavigator.KeywordIndex, SprinklerR717Reference.ResourceManager.GetString(sIndex));
        }
    }
}
    

